package com.acme.bankapp.service.bank;

import com.acme.bankapp.domine.bank.*;

public class BankService {
    public static Bank createNewBank(){
        return new Bank();
    }

    public static void addClient(Bank bank, Client client) {
        bank.addClient(client);
    }
    public static Client addClient(Bank bank, String name, Gender gender) {
        Client client = new Client(name, gender);
        bank.addClient(client);
        return client;
    }

    public static void printBalance(Bank bank) {
        System.out.println("printBalance");
        for (int i = 0; i < bank.getCountClients(); i++) {
            Client client = bank.getClients()[i];
            for (int j = 0; j < client.getCountAccount(); j++) {
                Account account = client.getAccounts()[j];
                System.out.println(client.getClientSalutation() + " : " + account.getBalance());
            }
        }
    }
    public static void printMaximumAmountToWithdraw(Bank bank){
        System.out.println("printMaximumAmountToWithdraw");
        for (int i = 0; i < bank.getCountClients(); i++) {
            Client client = bank.getClients()[i];
            for (int j = 0; j < client.getCountAccount(); j++) {
                Account account = client.getAccounts()[j];
                System.out.println(client.getClientSalutation() + " : " + account.maximumAmountToWithdraw());
            }
        }

    }
}
